const connection = require('../app/database')
class LabelService {
    async create(name) {
        // 2.拼接statement
        const statement = 'INSERT INTO `label` (name) VALUES (?);'
        // 3.执行sql语句
        const [result] = await connection.execute(statement, [name])
        return result
    }
    async queryLabelsByName(name) {
        const statement = 'SELECT * FROM `label` WHERE name = ?;'
        const [result] = await connection.execute(statement, [name])
        // console.log('result[0]', result[0])
        return result[0]
    }
}
module.exports = new LabelService()